package org.share.comm.db;

import java.sql.SQLException;
import java.util.List;

public class OracleDBUtils extends DBUtils {
	
	/**
	 * 分页查询
	 * 
	 * @param page
	 *            页数
	 * @param count
	 *            每页数量
	 */
	public static List<Object[]> executeOraclePageQuery(String sql, int page, int count, Object... params)
			throws SQLException {
		int startRowNum = (page - 1) * count + 1 <= 0 ? 1 : (page - 1) * count + 1;
		int endRowNum = page * count;
		sql = "SELECT * FROM (SELECT ROWNUM RN,T.* FROM (" + sql + " )T) WHERE RN >= " + startRowNum + " and  RN <= "
				+ endRowNum;
		return executeQuery(sql, params);
	}

}
